package  com.cnn.function.stock.controller;

import javax.annotation.Resource;

import com.cnn.function.stock.service.StockInDetailsService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cnn.base.util.JsonUtil;
import  com.cnn.function.stock.pojo.StockInDetails;

@RestController
@RequestMapping("/stockInDetails")
public class StockInDetailsController {

	@Resource
	private StockInDetailsService stockInDetailsService;

	@RequestMapping("/getStockInDetails")
	public String getStockInDetails() {
		return JsonUtil.success(stockInDetailsService.getStockInDetails());
	}

	@RequestMapping("/getStockInDetailsById")
	public String getStockInDetailsById(String id) {
		return JsonUtil.success(stockInDetailsService.getStockInDetailsById(Long.valueOf(id)));
	}

	@RequestMapping("/addStockInDetails")
	public String addStockInDetails(StockInDetails stockInDetails) {
		stockInDetailsService.addStockInDetails(stockInDetails);
		return JsonUtil.success();
	}

	@RequestMapping("/updateStockInDetails")
	public String updateStockInDetails(StockInDetails stockInDetails) {
		stockInDetailsService.updateStockInDetails(stockInDetails);
		return JsonUtil.success();
	}

	@RequestMapping("/deleteStockInDetails")
	public String deleteStockInDetails(String id) {
		stockInDetailsService.deleteStockInDetails(Long.valueOf(id));
		return JsonUtil.success();
	}
}
